import { http } from '../utils/http'
// import axios from "axios"

//获取所有用户列表
export const getUserListApi = () => {
  return http({
    url: 'user/all',
    method: 'GET',
  })
}

//根据用户id获取用户信息
export const getUserInfoApi = (id) => {
  return http({
    url: `user/${id}`,
    method: 'GET',
    data: {
      id
    }
  })
}

//用户登录
export const loginApi = (username,password) => {
  return http({
    url: `user/login?username=${username}&password=${password}`,
    method: 'GET',
    data: {
      username,
      password,
    }
  })
}

//用户注册
export const registerApi = (data) => {
  return http({
    url:'user',
    method: 'POST',
    data
  })
}